package com.jy.admin.rest.response;

import com.fqgj.common.utils.CollectionUtils;
import com.fqgj.common.utils.TimeUtils;
import com.jy.admin.db.entity.OpdUploadRecordEntity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2021/11/26
 * Time: 7:41 下午
 */
public class OpdListResponse implements Serializable {

    private static final long serialVersionUID = -8728681650293146671L;
    private List<Item> list = new ArrayList<>();

    public OpdListResponse(List<OpdUploadRecordEntity> uploadRecordEntities) {

        if (CollectionUtils.isNotEmpty(uploadRecordEntities)) {
            uploadRecordEntities.forEach(d -> {
                list.add(new Item()
                        .setDataNo(d.getDataNo())
                        .setNote(d.getNote())
                        .setType(d.getType())
                        .setFeedback(d.getFeedback())
                        .setStatus(d.getStatus())
                        .setEarn(d.getEarn())
                        .setExtra(d.getExtra())
                        .setDate(TimeUtils.toDateString("yyyy-MM-dd HH:mm:ss",d.getGmtCreate()))
                );
            });
        }
    }

    public List<Item> getList() {
        return list;
    }

    public OpdListResponse setList(List<Item> list) {
        this.list = list;
        return this;
    }

    private class Item {


        /**
         * 商户号
         */
        private String dataNo;

        /**
         * 商户号
         */
        private String ossUrl;
        /**
         * 商户号
         */
        private String note;
        /**
         *
         */
        private Integer type;
        /**
         * 商户号
         */
        private String feedback;
        /**
         * admin状态0-正常，1-禁用
         */
        private Integer status;

        /**
         * admin状态0-正常，1-禁用
         */
        private Integer earn;
        /**
         * admin状态0-正常，1-禁用
         */
        private String extra;
        private String date;


        public String getDate() {
            return date;
        }

        public Item setDate(String date) {
            this.date = date;
            return this;
        }

        public String getDataNo() {
            return dataNo;
        }

        public Item setDataNo(String dataNo) {
            this.dataNo = dataNo;
            return this;
        }

        public Integer getEarn() {
            return earn;
        }

        public Item setEarn(Integer earn) {
            this.earn = earn;
            return this;
        }

        public String getExtra() {
            return extra;
        }

        public Item setExtra(String extra) {
            this.extra = extra;
            return this;
        }

        public String getOssUrl() {
            return ossUrl;
        }

        public Item setOssUrl(String ossUrl) {
            this.ossUrl = ossUrl;
            return this;
        }

        public String getNote() {
            return note;
        }

        public Item setNote(String note) {
            this.note = note;
            return this;
        }

        public Integer getType() {
            return type;
        }

        public Item setType(Integer type) {
            this.type = type;
            return this;
        }

        public String getFeedback() {
            return feedback;
        }

        public Item setFeedback(String feedback) {
            this.feedback = feedback;
            return this;
        }

        public Integer getStatus() {
            return status;
        }

        public Item setStatus(Integer status) {
            this.status = status;
            return this;
        }
    }
}
